package com.yun.zf.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yun.zf.system.mapper.ZfInviteMapper;
import com.yun.zf.system.service.ZfInviteService;
import com.yun.zf.common.app.domain.ZfInvite;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 邀请记录表 服务实现类
 * </p>
 *
 * @author cj
 * @since 2021-06-09
 */
@Service
public class ZfInviteServiceImpl extends ServiceImpl<ZfInviteMapper, ZfInvite> implements ZfInviteService {

    @Override
    public int addInvite(ZfInvite invite) {
        invite.setCreateTime(new Date());
        return baseMapper.insert(invite);
    }

    @Override
    public int getMyinvite(Long userId) {
        QueryWrapper<ZfInvite> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(ZfInvite::getInviteId,userId);
        return baseMapper.selectCount(wrapper);
    }
}
